//
//  UIBarButtonItem+Extension.swift
//  WKweiBo
//
//  Created by 阿拉斯加的狗 on 15/12/17.
//  Copyright © 2015年 阿拉斯加的🐶. All rights reserved.
//

import UIKit


extension UIBarButtonItem {

    convenience init(imageName: String, target: AnyObject?, actionName:String?) {
    
        let button = UIButton(imageName: imageName, backImageName: nil)
    
        //判断actionName
        if let actionName = actionName {
        
            button.addTarget(target, action: Selector(actionName), forControlEvents: UIControlEvents.TouchUpInside)
        }
        
        self.init(customView:button)
        
    }

}